﻿using System.Windows.Forms;
using System.Drawing;

namespace checc_baseTools
{
    public class ElementAttribute
    {
        ///// <summary>
        ///// 修改对象 颜色
        ///// </summary>
        //public static void SettingColor(Color color)
        //{
        //    BPDocument doc = BPApplication.singleton().activeDocument;
        //    BPModel model = doc.modelManager.activeModel;

        //    IGeSolidBase solid = null;
        //    BPGraphics graphic = doc.selection.getElement(0);
        //    solid = graphic.getAsSolid(0);
        //    BPGeSymbology symbology = new BPGeSymbology();
        //    symbology.color = color;
        //    graphic.symbology = symbology;
        //    graphic.save();
        //}

        ///// <summary>
        ///// 修改对象 颜色
        ///// </summary>
        //public static void SettingColor(IGeSolidBase solid, Color color)
        //{
        //    BPDocument doc = BPApplication.singleton().activeDocument;
        //    BPModel model = doc.modelManager.activeModel;

        //    BPGraphics graphic = BPApplication.getInstance().getProjectManager().getActiveModel().createPhysicalGraphics();
        //    graphic.addSolid(solid);
        //    graphic.save();


        //    BPGeSymbology symbology = new BPGeSymbology();
        //    symbology.color = color;
        //    graphic.symbology = symbology;
        //    graphic.save();
        //}

        ///// <summary>
        ///// 修改基本曲线对象 颜色，线型，线宽
        ///// </summary>
        ///// <param name="curve">基本曲线</param>
        ///// <param name="color">颜色</param>
        ///// <param name="weight">线宽</param>
        ///// <param name="style">线型</param>
        //public static void SetCurveSymbology(IGeCurveBase curve, Color color, uint weight, int style)
        //{
        //    BPGraphics graphic = BPApplication.getInstance().getProjectManager().getActiveModel().createPhysicalGraphics();
        //    graphic.addCurve(curve);
        //    BPGeSymbology symbology = new BPGeSymbology();
        //    symbology.color = color;
        //    symbology.weight = weight;
        //    symbology.style = style;
        //    graphic.symbology = symbology;
        //    graphic.save();
        //}
        ///// <summary>
        ///// 赋予或修改对象 图层
        ///// </summary>
        //public static void SettingLayers(BPLayersInfo info, BPLayerId layerId, string layerName)
        //{
        //    BPDocument doc = BPApplication.singleton().activeDocument;
        //}

        ///// <summary>
        ///// 新建图层
        ///// </summary>
        ///// <param name="layerName">图层名字</param>
        ///// <param name="m_color">图层颜色</param>
        ///// <param name="m_style">图层线型</param>
        ///// <param name="m_isVisible">图层上是否显示图素</param>
        //public static void AddLayers(string layerName, uint m_color, int m_style, bool m_isVisible)
        //{
        //    BPDocument doc = BPApplication.singleton().activeDocument;

        //    BPLayerId layerId = new BPLayerId();
        //    int status = BPLayersUtil.getLayerIdByName(ref layerId, doc, layerName);
        //    BPLayersInfo info = new BPLayersInfo();
        //    info.m_color = m_color;
        //    info.m_style = m_style;
        //    info.m_name = layerName;
        //    info.m_isVisible = m_isVisible;

        //    if (status == 1)//说明要新建一个这个图层
        //    {
        //        BPLayersUtil.createLayer(ref layerId, doc, info);
        //        MessageBox.Show("创建图层成功");
        //    }
        //    else
        //    {
        //        MessageBox.Show("已经有该图层");
        //    }
        //}

        ///// <summary>
        ///// 删除图层
        ///// </summary>
        ///// <param name="layerName">图层名字</param>
        ///// <param name="m_color">图层颜色</param>
        ///// <param name="m_style">图层线型</param>
        ///// <param name="m_isVisible">图层上是否显示图素</param>
        //public static void DeleteLayers(string layerName, uint m_color, int m_style, bool m_isVisible)
        //{
        //    BPDocument doc = BPApplication.singleton().activeDocument;

        //    BPLayerId layerId = new BPLayerId();
        //    int status = BPLayersUtil.getLayerIdByName(ref layerId, doc, layerName);
        //    BPLayersInfo info = new BPLayersInfo();
        //    info.m_color = m_color;
        //    info.m_style = m_style;
        //    info.m_name = layerName;
        //    info.m_isVisible = m_isVisible;


        //    if (status != 1)
        //    {
        //        BPLayersUtil.deleteLayer(doc, info);
        //        MessageBox.Show("删除图层完成");
        //    }
        //    else
        //    {
        //        MessageBox.Show("没有此图层");
        //    }
        //}

        ///// <summary>
        ///// 修改图层
        ///// </summary>
        ///// <param name="layerName">图层名字</param>
        ///// <param name="m_color">图层颜色</param>
        ///// <param name="m_style">图层线型</param>
        ///// <param name="m_isVisible">图层上是否显示图素</param>
        //public static void EditLayers(string layerName, uint m_color, int m_style, bool m_isVisible)
        //{
        //    BPDocument doc = BPApplication.singleton().activeDocument;

        //    BPLayerId layerId = new BPLayerId();
        //    int status = BPLayersUtil.getLayerIdByName(ref layerId, doc, layerName);
        //    BPLayersInfo info = new BPLayersInfo();
        //    info.m_color = m_color;
        //    info.m_style = m_style;
        //    info.m_name = layerName;
        //    info.m_isVisible = m_isVisible;

        //    if (status == 1)//说明要新建一个这个图层
        //    {
        //        BPLayersUtil.createLayer(ref layerId, doc, info);
        //    }
        //    else
        //    {
        //        BPLayersUtil.editLayer(doc, info);
        //        MessageBox.Show("修改完成");
        //    }
        //}

        ///// <summary>
        ///// 赋予或修改对象 材质
        ///// </summary>
        //public static void SettingMaterial(BPMaterial material2)
        //{
        //    BPDocument doc = BPApplication.singleton().activeDocument;
        //    BPModel model = doc.modelManager.activeModel;

        //    IGeSolidBase solid = null;
        //    BPGraphics graphic = doc.selection.getElement(0);
        //    solid = graphic.getAsSolid(0);

        //    //solid.transform(GeTransform.create(new GePoint3d(4000, 0, 0)));            
        //    graphic.save();
        //    BPMaterial.setMaterialToEntity(graphic, material2, true);
        //    BPMaterial.updateMaterial(material2, true, true, true, doc);
        //}
        ///// <summary>
        ///// 赋予或修改对象 材质
        ///// </summary>
        //public static void SettingMaterial(BPGraphics graphic, BPMaterial material2)
        //{
        //    BPDocument doc = BPApplication.singleton().activeDocument;
        //    BPModel model = doc.modelManager.activeModel;

        //    graphic.save();

        //    BPMaterial.setMaterialToEntity(graphic, material2, true);
        //    BPMaterial.updateMaterial(material2, true, true, true, doc);
        //}

        ///// <summary>
        ///// 赋予或修改对象 材质
        ///// </summary>
        //public static void SettingMaterial(IGeSolidBase solid, BPMaterial material2)
        //{
        //    BPDocument doc = BPApplication.singleton().activeDocument;
        //    BPModel model = doc.modelManager.activeModel;


        //    BPGraphics graphic = BPApplication.getInstance().getProjectManager().getActiveModel().createPhysicalGraphics();
        //    graphic.addSolid(solid);
        //    graphic.save();

        //    BPMaterial.setMaterialToEntity(graphic, material2, true);
        //    BPMaterial.updateMaterial(material2, true, true, true, doc);
        //}

        ///// <summary>
        ///// 修改链状对象 线型
        ///// </summary>
        //public static void SettingLinear(int style)
        //{
        //    BPDocument doc = BPApplication.singleton().activeDocument;
        //    BPModel model = doc.modelManager.activeModel;

        //    IGeSolidBase solid = null;
        //    BPGraphics graphic = doc.selection.getElement(0);
        //    solid = graphic.getAsSolid(0);
        //    BPGeSymbology symbology = new BPGeSymbology();
        //    symbology.style = style;
        //    graphic.symbology = symbology;
        //    graphic.save();
        //}

        ///// <summary>
        ///// 修改链状对象 线宽
        ///// </summary>
        //public static void SettingLineWidth(uint wight)
        //{
        //    BPDocument doc = BPApplication.singleton().activeDocument;
        //    BPModel model = doc.modelManager.activeModel;

        //    IGeSolidBase solid = null;
        //    BPGraphics graphic = doc.selection.getElement(0);
        //    solid = graphic.getAsSolid(0);
        //    BPGeSymbology symbology = new BPGeSymbology();
        //    symbology.weight = wight;
        //    graphic.symbology = symbology;
        //    graphic.save();
        //}
    }
}
